/*
题目链接:https://leetcode.cn/problems/count-prefixes-of-a-given-string/description/?envType=daily-question&envId=2025-03-24
*/
//题解代码:
class Solution {
public:
    int countPrefixes(vector<string>& words, string s) {
        int ans = 0;
        for(auto& wd : words){
            if(s.substr(0,wd.size()) == wd) ++ans;
        }
        return ans;
    }
};
